package query

import (
	"GoTY/api"
	"encoding/json"
	"io"
	"log"
	"net/http"
)

func Query(url string) []api.ApiResponse {
	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}

	var sr []api.ApiResponse
	err = json.Unmarshal(body, &sr)
	if err != nil {
		log.Fatal(err)
	}

	return sr
}
